
from machine import Pin,SPI
from st7735 import ST7735,color
from ufont import BMFont
import time
import random

 
font = BMFont("font.bmf")
 
spi = SPI(1,baudrate = 60_000_000,polarity = 0,sck = Pin(2),mosi = Pin(3),miso = None)
tft = ST7735(spi,rst = 10,dc = 6,cs = 7,bl = 8, width = 160, height = 110, offset=(-1,0)  ,rotate = 1, rgb = True)



def Title():
    font.text(tft,"今天又是加油的一天呀" ,0,0,color(random.randint(1,256),random.randint(1,256),random.randint(1,256)),font_size = 16,reverse = False,clear = False,show = True,half_char = True,auto_wrap = False)   

def main():
    now = time.localtime()
    print(now)

    while True:
        Title()
        time.sleep(1)
            
   
        
        
if __name__ == "__main__":
    
    main()
   
    

